<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			var date  = new Date();
			console.log("current date: " + date);
			var year = date.getFullYear();
			console.log("current year : " + year);
			var month = date.getMonth();//从0开始
			console.log("current month: " + (month+1));
			
			// 通过 Date 构造函数传入年份、月份、零，然后通过调用获取日期函数即可获取当前月份有多少天
			var day = new Date(year, month+1, 0).getDate();
			var day2 = new Date(2019,04,0).getDate();
			console.log(day);
			console.log(day2);
			console.log("----------------------------------------")
			
			var date = new Date();
			//年统计
			var year = date.getFullYear();//获取当前年份
			var month = date.getMonth();//获取当前月份,从0开始
			var startTime = (year - 3 )+ (month + 1);
			var endTime = year + (month + 1);
			
		</script>
	</body>
</html>
